package com.aatattoo.light_food_service.service;

import com.aatattoo.light_food_service.entity.DynamicTag;
import com.aatattoo.light_food_service.mapper.DynamicTagMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author aatattoo
 * @Date 2021/12/9 11:00 上午
 * @msg:
 */
@Service
@Component
public class DynamicTagService {
    @Autowired
    private DynamicTagMapper dynamicTagMapper;

    public DynamicTag findById(int id){
        return dynamicTagMapper.findById(id);
    }

    public DynamicTag findByContent(String content){
        return dynamicTagMapper.findByContent(content);
    }


    public List<DynamicTag> findAll(int type){
        return dynamicTagMapper.findAll(type);
    }

    public int addDynamicTag(String content){
        return dynamicTagMapper.addDynamicTag(content);
    }

    public int addDynamicTagUser(DynamicTag dynamicTag){
        dynamicTagMapper.addDynamicTagUser(dynamicTag);
        int id = dynamicTag.getId();
        return id;
    }

    public int isTableExist(String content){
        return dynamicTagMapper.isTableExist(content);
    }

    public List<DynamicTag> fuzzyQuery(@Param("content")String content){
        return dynamicTagMapper.fuzzyQuery(content);
    }
}